<div class="admin_left actions">
  <h3><?php echo __('Actions'); ?></h3>
  <ul>
    <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('Edit Delivery'), array('action' => 'edit', $delivery['Delivery']['id'])); ?> </li>
    <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Form->postLink(__('Delete Delivery'), array('action' => 'delete', $delivery['Delivery']['id']), null, __('Are you sure you want to delete # %s?', $delivery['Delivery']['id'])); ?> </li>
    <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('List Deliveries'), array('action' => 'index')); ?> </li>
    <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('New Delivery'), array('action' => 'add')); ?> </li>
    <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('List Orders'), array('controller' => 'orders', 'action' => 'index')); ?> </li>
    <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('New Order'), array('controller' => 'orders', 'action' => 'add')); ?> </li>
    <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('List Items'), array('controller' => 'items', 'action' => 'index')); ?> </li>
    <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('New Item'), array('controller' => 'items', 'action' => 'add')); ?> </li>
    <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('List Delivery Statuses'), array('controller' => 'delivery_statuses', 'action' => 'index')); ?> </li>
    <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('New Delivery Status'), array('controller' => 'delivery_statuses', 'action' => 'add')); ?> </li>
    <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('List Sales'), array('controller' => 'sales', 'action' => 'index')); ?> </li>
    <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('New Sale'), array('controller' => 'sales', 'action' => 'add')); ?> </li>
  </ul>
</div>
<div id="pinkHeader" class="admin_right purchases form">
<div id=breadcrumbAdmin>
  <?php $this->Html->addCrumb('View', '/deliveries/view/'.$delivery['Delivery']['id'], array('style'=> ('text-decoration:underline;  color:#EB1E70;'))); ?>
  <?php echo $this->Html->getCrumbs(' > ', array( 'text' => 'Deliveries', 'url' => array('controller' => 'deliveries', 'action' => 'index'), 'escape' => false)); ?> </div>
<table cellpadding="0" cellspacing="0" class=" table table-bordered table-hover" width="80%">
  <tr>
    <th><?php echo __('Id'); ?></th>
    <th><?php echo __('Order'); ?></th>
    <th><?php echo __('Item'); ?></th>
    <th><?php echo __('Delivery Status'); ?></th>
    <th><?php echo __('Tracking'); ?></th>
    <th><?php echo __('Note'); ?></th>
    <th><?php echo __('Created'); ?></th>
    <th><?php echo __('Modified'); ?></th>
  </tr>
  <tr>
    <td><?php echo h($delivery['Delivery']['id']); ?></td>
    <td><?php echo $this->Html->link($delivery['Order']['id'], array('controller' => 'orders', 'action' => 'view', $delivery['Order']['id'])); ?></td>
    <td><?php echo $this->Html->link($delivery['Item']['name'], array('controller' => 'items', 'action' => 'view', $delivery['Item']['id'])); ?></td>
	<td><?php echo $this->Html->link($delivery['DeliveryStatus']['name'], array('controller' => 'delivery_statuses', 'action' => 'view', $delivery['DeliveryStatus']['id'])); ?></td>
    <td><?php echo h($delivery['Delivery']['tracking']); ?></td>
    <td><?php echo h($delivery['Delivery']['note']); ?></td>
    <td><?php echo h($delivery['Delivery']['created']); ?></td>
    <td><?php echo h($delivery['Delivery']['modified']); ?></td>
  </tr>
</table>
<div class="related">
  <h3><?php echo __('Related Sales'); ?></h3>
  <?php if (!empty($delivery['Sale'])): ?>
  <table cellpadding = "0" cellspacing = "0">
    <tr>
      <th><?php echo __('Id'); ?></th>
      <th><?php echo __('Delivery Id'); ?></th>
      <th><?php echo __('Customer Id'); ?></th>
      <th><?php echo __('Sale Price'); ?></th>
      <th><?php echo __('Locaion Id'); ?></th>
      <th><?php echo __('Balance'); ?></th>
      <th><?php echo __('Sale Original Price'); ?></th>
      <th><?php echo __('Sale Type'); ?></th>
      <th><?php echo __('Discount Amout'); ?></th>
      <th><?php echo __('Discount Type'); ?></th>
      <th><?php echo __('Created'); ?></th>
      <th><?php echo __('Modified'); ?></th>
      <th class="actions"><?php echo __('Actions'); ?></th>
    </tr>
    <?php
		$i = 0;
		foreach ($delivery['Sale'] as $sale): ?>
    <tr>
      <td><?php echo $sale['id']; ?></td>
      <td><?php echo $sale['delivery_id']; ?></td>
      <td><?php echo $sale['customer_id']; ?></td>
      <td><?php echo $sale['sale_price']; ?></td>
      <td><?php echo $sale['locaion_id']; ?></td>
      <td><?php echo $sale['balance']; ?></td>
      <td><?php echo $sale['sale_original_price']; ?></td>
      <td><?php echo $sale['sale_type']; ?></td>
      <td><?php echo $sale['discount_amout']; ?></td>
      <td><?php echo $sale['discount_type']; ?></td>
      <td><?php echo $sale['created']; ?></td>
      <td><?php echo $sale['modified']; ?></td>
      <td class="actions"><?php echo $this->Html->link(__('View'), array('controller' => 'sales', 'action' => 'view', $sale['id'])); ?> <?php echo $this->Html->link(__('Edit'), array('controller' => 'sales', 'action' => 'edit', $sale['id'])); ?> <?php echo $this->Form->postLink(__('Delete'), array('controller' => 'sales', 'action' => 'delete', $sale['id']), null, __('Are you sure you want to delete # %s?', $sale['id'])); ?> </td>
    </tr>
    <?php endforeach; ?>
  </table>
  <?php endif; ?>
  <div class="actions">
    <ul>
      <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('New Sale'), array('controller' => 'sales', 'action' => 'add')); ?> </li>
    </ul>
  </div>
</div>
